<template>
  <!-- div和img是行内标签，同一行 -->
  <div class="tab-bar-item">
    <!-- 增加一个判断 -->
    <div v-if="!isActive">
      <slot name="item-icon"></slot>
    </div>
    <div v-else>
      <slot name="item-icon-active"></slot>
    </div>
    <div :class="{active: isActive}" >
      <slot name="item-text"></slot>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isActive: true
    }
  }
}
</script>

<style>
/* 单个选项的样式 */
.tab-bar-item {
  flex: 1;
  text-align: center;
  height: 49px;
  width: 14px;
  font-size: 14px;
}
/* 设置图片大小 */
.tab-bar-item img {
  height: 24px;
  width: 24px;
  margin-top: 3px;
  vertical-align: middle;
}
/* 按钮动态颜色 */
.active {
  color: red;
}
</style>